# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pygtail
pkgname=('python2-pygtail' 'python-pygtail')
_pkgname=pygtail
pkgver=0.14.0
pkgrel=4
pkgdesc='Reads log file lines that have not been read.'
arch=('any')
url='https://pypi.org/project/pygtail/#files'
license=('GPL2')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('7446c622ec17a5051a0d3caa9cb00c37a261ef735f434c52b6088ed22b7add4e58c94d4b7006549468067f8c032046b79406e2d5899de85e314e90b23ce739c2')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pygtail() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-pygtail() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

